<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.multiplayer.entity.User"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>

<!--js/jquery-2.0.3.js -->
<script src="${pageContext.request.contextPath}/js/jquery-2.0.3.js"></script>
<!-- Bootstrap -->
<link href="${pageContext.request.contextPath}/personal/css/crowdfunding.center/my_info.css" rel="stylesheet">
</head>
<body>
<%
     User user=(User)session.getAttribute("user");
%>
<!-- 开始 -->
<div class="my_info_title">修改密码</div>
<div class="my_info_title_3">
  <ul>
    <li id="listClick_1" >基本资料</li>
    <li id="listClick_4" style="border-bottom: 1px solid #C40521; color: #C40521;">修改密码</li>
  </ul>
</div>
<div class="my_info_content">
	<form action="../../PersonalServlet?op=updatePwd" method="post" onsubmit="return check()">
  <table class="my_info_content_care_table" >
    <tbody>
        <input type="hidden" id="userId" name="userId" value="<%=user.getUserid()%>">
      <tr>
        <td width="300" align="right" class="color555">旧密码：</td>
        <td class="color555">
        <input class="my_info_content_care_table_text" id="oldPwd" name="oldPwd" type="password" value="">
          <span id="SoldPwd"class="colorCA1E37 margin_left10 font_size12">请输入旧密码</span></td>
      </tr>
      <tr>
        <td align="right" class="color555">新密码：</td>
        <td class="color555"><input class="my_info_content_care_table_text" id="newPwd" name="newPwd" type="password">
          <span class="colorCA1E37 margin_left10 font_size12">请输入新密码</span></td>
      </tr>
      <tr>
        <td align="right" class="color555">确认新密码：</td>
        <td class="color555"><input class="my_info_content_care_table_text" id="rNewPwd" name="rNewPwd" type="password">
          <span id="SrNewPwd" class="colorCA1E37 margin_left10 font_size12">请再次输入</span></td>
      </tr>
      <tr>
        <td align="center" class="color555" colspan="2">
        	<input class="my_info_content_care_table_submit" name="" type="submit" value="修改" >
        	<span id="SrNewPwd" class="colorCA1E37 margin_left10 font_size12"><%=request.getAttribute("uPResult")%></span>
        	</td>
      </tr>
    </tbody>
  </table>
  </form>
 
</div>

<!-- 结束 --> 
<script src="${pageContext.request.contextPath}/js/jquery-2.1.1.min.js"></script> 
<script src="${pageContext.request.contextPath}/js/my_info.js"></script>
<script>
	$(function() {
		$("#oldPwd").blur(function() {
			$.ajax({
				//key:value
				url : "../../PersonalServlet",
				type : "get",
				data : {
					userId:$("#userId").val(),
					oldPwd : $("#oldPwd").val(),
					op:"judjeOldPwd",
				},
				success:function(data){
					mgsone=data;
					$("#SoldPwd").html(data);
					
				},
				dataType: "json"

			});
		});
		$("#rNewPwd").blur(function() {
			$.ajax({
				//key:value
				url : "../../PersonalServlet",
				type : "get",
				data : {
					newPwd:$("#newPwd").val(),
					rNewPwd:$("#rNewPwd").val(),
					op:"judjeNPwd",
				},
				success:function(data){
					mgstwo=data;
					$("#SrNewPwd").html(data);
				},
				dataType: "json"
			});
		});
		
		
	});
	
	function check() {

		//点击修改按钮的时候，都要判断是否有重复的内容(类型重复)

		//1 重复校验和判断
          
		if (mgsone=="输入密码正确可以修改！"){
			if(mgstwo=="新密码两次输入一致！"){
				return true;//表单要提交
			}else{
				return false;
			}
			
		} else {
			return false;//2表单不提交
		}
	}
</script>
</body>
</html>